﻿namespace SuperModel.Generation
{
    using System;
    using System.ComponentModel;
    using System.Linq;

    /// <summary>
    /// An interface validator
    /// </summary>
    internal class TargetTypeValidator
    {
        /// <summary>
        /// Determines if the type is a valid type to implement
        /// </summary>
        /// <param name="t">
        /// The type to implement.
        /// </param>
        /// <param name="message">
        /// The message.
        /// </param>
        /// <returns>
        /// A value indicating whether the target type is valid or not.
        /// </returns>
        public bool Validate(Type t, out string message)
        {
            message = string.Empty;

            // The Target must be an interface
            if (!t.IsInterface)
            {
                message = "Target type must be an interface";
                return false;
            }

            //// The target must implement ISuperModel
            //if (!typeof(ISuperModel).IsAssignableFrom(t.GetType()))
            //{
            //    message = "Target must be assignable from ISuperModel";
            //    return false;
            //}

            //// The target must not have any methods
            //if (t.GetMethods().Count() > 0)
            //{
            //    message = "Target Type must not contain any methods";
            //    return false;
            //}

            return true;
        }
    }
}
